<?php $this->load->view('headerfooter/header'); ?>
 <!-- Begin page content -->
<div class="container">
	<div class="col-sm-10 col-sm-offset-1">
        <div class="panel panel-success">
			<div class="panel-heading">
				<div class="panel-title"><?=$title?></div>
			</div>
			<div class="panel-isi" id="printableArea">
				<table class="table table-striped">
					<thead>
						<tr>
							<th>No</th>
							<th>Username</th>
							<th>Nama Lengkap</th>
							<th>Role</th>
							<th colspan="2">Action</th>
						</tr>
					</thead>
					<tbody class="table-hover">
					<?php // show all user
                    $i = 1;
                    foreach ($query->result() as $row) : ?>
						<tr>
                            <td><?=$i++?></td>
                            <td><?=$row->nama_user?></td>
                            <td><?=$row->nama_lengkap?></td>
							<?php if($row->role == 1){
								$role = 'Master Admin';
							}else if($row->role == 2){
								$role = 'Editor';
							} else {
								$role = 'User';
							} ?>
                            <td><?=$role?></td>
                            <td  width="82px">
                            	<a href="<?=site_url('user/edit_role')?>/<?=$row->idloginuser?>" class="btn btn-primary"><i class="fa fa-pencil"></i> Edit</a>
                            </td>
                            <td width="82px">
                            	<form method="post" action="<?=site_url('user/delete_user')?>">
                            		<input type="hidden" name="id" value="<?=$row->idloginuser?>">
                            		<button type="submit" class="btn btn-danger"><i class="fa fa-trash-o"></i> Hapus</button>
                            	</form> 
                            </td>
						</tr>
					<?php endforeach; ?>
					</tbody>
				</table>
				<div class="text-right">
					<?php echo $pagination;?>
				</div>
			</div>
		</div>
	</div>
</div>
<?php $this->load->view('headerfooter/footer'); ?>